<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>删除操作</title>
</head>

<body>
    <ul>
        <li>
            <span>辗迟</span>
            <a title="删除">×</a>
        </li>
        <li>
            <span>火麟飞</span>
            <a title="删除">×</a>
        </li>
        <li>
            <span>曹焱兵</span>
            <a title="删除">×</a>
        </li>
    </ul>
    <script>
        let aEles = document.querySelectorAll("ul li a");
        [...aEles].forEach((aEle) => {
            aEle.addEventListener("click", function () {
                if (confirm("确认删除吗")) {
                    // 方式1：节点.remove()
                    this.parentElement.remove();
                    // 方式2：父节点.removeChild(子节点)
                    // this.parentElement.parentElement.removeChild(this.parentElement);
                }
            })
        })
    </script>
</body>

</html>